/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.oneCommerce.entities;

import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Aymen
 */
@Entity
@Table(name = "ITEM_FOUR", catalog = "", schema = "AYMEN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ItemFour.findAll", query = "SELECT i FROM ItemFour i"),
    @NamedQuery(name = "ItemFour.findByIditem", query = "SELECT i FROM ItemFour i WHERE i.itemFourPK.iditem = :iditem"),
    @NamedQuery(name = "ItemFour.findByIdfour", query = "SELECT i FROM ItemFour i WHERE i.itemFourPK.idfour = :idfour"),
    @NamedQuery(name = "ItemFour.findByLeader", query = "SELECT i FROM ItemFour i WHERE i.leader = :leader")})
public class ItemFour implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ItemFourPK itemFourPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "LEADER", nullable = false)
    private boolean leader;

    public ItemFour() {
    }

    public ItemFour(ItemFourPK itemFourPK) {
        this.itemFourPK = itemFourPK;
    }

    public ItemFour(ItemFourPK itemFourPK, boolean leader) {
        this.itemFourPK = itemFourPK;
        this.leader = leader;
    }

    public ItemFour(BigInteger iditem, BigInteger idfour) {
        this.itemFourPK = new ItemFourPK(iditem, idfour);
    }

    public ItemFourPK getItemFourPK() {
        return itemFourPK;
    }

    public void setItemFourPK(ItemFourPK itemFourPK) {
        this.itemFourPK = itemFourPK;
    }

    public boolean getLeader() {
        return leader;
    }

    public void setLeader(boolean leader) {
        this.leader = leader;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (itemFourPK != null ? itemFourPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemFour)) {
            return false;
        }
        ItemFour other = (ItemFour) object;
        if ((this.itemFourPK == null && other.itemFourPK != null) || (this.itemFourPK != null && !this.itemFourPK.equals(other.itemFourPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.oneCommerce.entities.ItemFour[ itemFourPK=" + itemFourPK + " ]";
    }
    
}
